package priv.work2;

import java.io.IOException;
import java.io.OutputStream;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;



@Configuration
@ImportResource("classpath:work2/app.cfg.xml")
public class Work {

	public static void main(String[] args) {
		ApplicationContext context = 
				new AnnotationConfigApplicationContext(Work.class);
		
		XiaoMing bean = context.getBean(XiaoMing.class);
		System.out.println(bean);
		
		OutputStream bean2 = context.getBean(OutputStream.class);
		String str="today is goodday\r\n" + 
				"the cloud is not found\r\n" + 
				"the air is soo cold\r\n" + 
				"my foot quik missing";
		try {
			bean2.write(str.getBytes());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		ManagerMent bean3 = context.getBean(ManagerMent.class);
		
		System.out.println(bean3);
	}

}
